package packet1;

public class test_lc_o_14 {
    public static void main(String[] args) {
        System.out.println(cuttingRope(127));
    }
    public static int cuttingRope(int n) {
        long re = 1;
        if(n < 4)
            return n - 1;
        while(n > 4)
        {
            re = re * 3 % 1000000007;
            n -= 3;
        }
        return (int)(re * n % 1000000007);
    }
}
